﻿using System.Text;

namespace CommonUtils
{
    public class ProcessExcuteInfo
    {
        /// <summary>
        /// 进程详情
        /// </summary>
        public string StartInfo;

        public string Output;

        public string Error;

        public bool HasError
        {
            get
            {
                return !string.IsNullOrEmpty(Error);
            }
        }

        public string Result
        {
            get
            {
                var message = new StringBuilder();
                message.AppendLine("[Output]");
                message.AppendLine(Output);
                message.AppendLine();
                message.AppendLine("[Error]");
                message.AppendLine(Error);
                return message.ToString();
            }
        }

        public override string ToString()
        {
            var message = new StringBuilder(StartInfo);
            message.AppendLine();
            message.Append(Result);
            return message.ToString();
        }

        public static ProcessExcuteInfo Default = new ProcessExcuteInfo { StartInfo = "Process not run." };
    }
}
